CONTENTS | INDEX | PREV | NEXT
setbuf
NAME
setbuf - set alternative stream buffer
SYNOPSIS
#include <stdio.h>
void setbuf(fp, buf);
FILE *fp;
char *buf;
FUNCTION
setbuf() changes the internal buffer used by stdio. The buffer you
pass it must be BUFSIZ bytes in size. You can set a file pointer
to unbuffered by passing NULL for your buffer.
setvbuf() superceeds this call and is, in general, a better routine.
NOTE
refer to the file_pointer manual page for general information
!!
if buffering is turned off for a file pointer representing a
console device, the console device is set to unbuffered as well.
EXAMPLE
#include <stdio.h>
main()
{
setbuf(stdout, NULL);
printf("This will print immediately because");
sleep(1);
printf(" we are unbuffered");
sleep(1);
puts("");
return(0);
}
INPUTS
FILE *fp; file pointer to rewind
char *buf; buffer the file pointer uses instead of its
own or NULL to make the file pointer unbuffered.
RESULTS
none
SEE ALSO
setvbuf